```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RocketMQ消息重试机制全解析 | 技术小馆</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4, h5, h6 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
            color: #222;
        }
        .prose {
            max-width: 900px;
        }
        .drop-cap::first-letter {
            float: left;
            font-size: 4em;
            line-height: 0.8;
            margin: 0.1em 0.1em 0.1em 0;
            color: #4f46e5;
        }
        .code-block {
            background-color: #2d3748;
            color: #f7fafc;
            border-radius: 0.5rem;
            overflow-x: auto;
        }
        .code-block pre {
            margin: 0;
            padding: 1rem;
        }
        .hover-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .gradient-text {
            background: linear-gradient(90deg, #4f46e5, #10b981);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }
        .timeline-item::before {
            content: "";
            position: absolute;
            left: -1.75rem;
            top: 0;
            height: 100%;
            width: 4px;
            background: linear-gradient(to bottom, #4f46e5, #10b981);
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="relative bg-gradient-to-r from-indigo-900 to-gray-900 text-white py-24 px-4">
        <div class="max-w-6xl mx-auto relative z-10">
            <div class="flex flex-col items-center text-center">
                <div class="inline-block bg-indigo-600 text-white text-xs font-semibold px-3 py-1 rounded-full mb-4">
                    <i class="fas fa-rocket mr-1"></i> RocketMQ 深入解析
                </div>
                <h1 class="text-4xl md:text-5xl font-bold mb-6 leading-tight">
                    深入理解 <span class="gradient-text">RocketMQ</span> 消息重试机制
                </h1>
                <p class="text-xl text-indigo-200 max-w-2xl">
                    全面解析消息重试的触发条件、配置方法和最佳实践，构建高可靠的分布式消息系统
                </p>
                <div class="mt-8 flex space-x-4">
                    <a href="#triggers" class="px-6 py-3 bg-indigo-600 hover:bg-indigo-700 rounded-lg font-medium transition duration-300">
                        <i class="fas fa-bolt mr-2"></i>开始阅读
                    </a>
                </div>
            </div>
        </div>
        <div class="absolute inset-0 bg-gradient-to-t from-black/70 to-transparent opacity-50"></div>
    </section>

    <!-- Main Content -->
    <main class="max-w-6xl mx-auto px-4 py-12">
        <article class="prose mx-auto">
            <!-- Introduction -->
            <section class="mb-16">
                <p class="drop-cap text-lg leading-relaxed">
                    RocketMQ的消息重试机制是确保消息可靠传递的核心特性之一。在高并发分布式系统中，各种临时性故障可能导致消息消费失败，合理配置和使用重试机制对于构建健壮的消息系统至关重要。
                </p>
                <div class="flex items-center bg-blue-50 rounded-lg p-4 mt-6 border-l-4 border-blue-500">
                    <i class="fas fa-info-circle text-blue-500 text-2xl mr-3"></i>
                    <p class="text-blue-800 m-0">
                        消息重试机制允许系统在遇到临时性故障时自动重新尝试消费消息，大大提高了系统的容错能力和可靠性。
                    </p>
                </div>
            </section>

            <!-- Triggers Section -->
            <section id="triggers" class="mb-16">
                <h2 class="text-3xl font-bold mb-8 pb-2 border-b border-gray-200 flex items-center">
                    <i class="fas fa-bolt text-indigo-500 mr-3"></i>
                    RocketMQ消息重试的触发条件
                </h2>
                
                <p class="text-lg">
                    RocketMQ的消息重试机制主要针对消费者端消费失败的情况，在不同场景下有不同的触发条件。
                </p>

                <div class="grid md:grid-cols-2 gap-8 mt-8">
                    <!-- Card 1 -->
                    <div class="bg-white rounded-xl shadow-md overflow-hidden hover-card transition duration-300">
                        <div class="p-6">
                            <div class="flex items-center mb-4">
                                <div class="bg-indigo-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-retweet text-indigo-600"></i>
                                </div>
                                <h3 class="text-xl font-bold">消费者返回RECONSUME_LATER状态</h3>
                            </div>
                            <ul class="space-y-3 text-gray-700">
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                    <span><strong>主动触发重试</strong>: 当消费者的MessageListener实现返回ConsumeConcurrentlyStatus.RECONSUME_LATER状态时</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                    <span>表示消费者主动要求稍后重新消费该消息</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                    <span>适用于暂时性的处理失败，如依赖服务暂时不可用</span>
                                </li>
                            </ul>
                            
                            <div class="code-block mt-4">
                                <pre><code class="language-java">public ConsumeConcurrentlyStatus consumeMessage(List&lt;MessageExt&gt; msgs, ConsumeConcurrentlyContext context) {
    try {
        // 消息处理逻辑
        if (处理失败) {
            // 返回稍后重试的状态
            return ConsumeConcurrentlyStatus.RECONSUME_LATER;
        }
        return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
    } catch (Exception e) {
        // 异常情况下也返回重试状态
        return ConsumeConcurrentlyStatus.RECONSUME_LATER;
    }
}</code></pre>
                            </div>
                        </div>
                    </div>

                    <!-- Card 2 -->
                    <div class="bg-white rounded-xl shadow-md overflow-hidden hover-card transition duration-300">
                        <div class="p-6">
                            <div class="flex items-center mb-4">
                                <div class="bg-red-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-exclamation-triangle text-red-600"></i>
                                </div>
                                <h3 class="text-xl font-bold">消费过程抛出异常</h3>
                            </div>
                            <ul class="space-y-3 text-gray-700">
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                    <span><strong>异常触发重试</strong>: 消费者处理消息过程中抛出未捕获的异常</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                    <span>消费线程会捕获异常并自动将消费状态设为RECONSUME_LATER</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                    <span>适用于未预期的错误情况</span>
                                </li>
                            </ul>
                            
                            <div class="code-block mt-4">
                                <pre><code class="language-java">try {
    // 调用用户的消费逻辑
    status = listener.consumeMessage(toConsumeObject, context);
} catch (Throwable e) {
    // 捕获异常并变更状态为重试
    status = ConsumeConcurrentlyStatus.RECONSUME_LATER;
}</code></pre>
                            </div>
                        </div>
                    </div>

                    <!-- Card 3 -->
                    <div class="bg-white rounded-xl shadow-md overflow-hidden hover-card transition duration-300 md:col-span-2">
                        <div class="p-6">
                            <div class="flex items-center mb-4">
                                <div class="bg-yellow-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-clock text-yellow-600"></i>
                                </div>
                                <h3 class="text-xl font-bold">消费超时</h3>
                            </div>
                            <ul class="space-y-3 text-gray-700">
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                    <span><strong>超时触发条件</strong>: 消费线程执行时间超过设定的consumeTimeout值</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                    <span>默认消费超时时间为15分钟</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                    <span>仅在特定消费模式下生效(并发消费模式)</span>
                                </li>
                            </ul>
                            
                            <div class="grid md:grid-cols-2 gap-6 mt-4">
                                <div>
                                    <h4 class="font-semibold mb-2 text-gray-800">配置方式</h4>
                                    <div class="code-block">
                                        <pre><code class="language-java">// 设置消费超时时间为60秒
consumer.setConsumeTimeout(60);</code></pre>
                                    </div>
                                </div>
                                <div>
                                    <h4 class="font-semibold mb-2 text-gray-800">适用场景</h4>
                                    <ul class="list-disc pl-5 text-gray-700 space-y-2">
                                        <li>防止消费线程长时间阻塞</li>
                                        <li>确保系统资源可以释放和重新分配</li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>

            <!-- Configuration Section -->
            <section id="configuration" class="mb-16">
                <h2 class="text-3xl font-bold mb-8 pb-2 border-b border-gray-200 flex items-center">
                    <i class="fas fa-cog text-indigo-500 mr-3"></i>
                    重试次数和间隔的配置方法
                </h2>

                <div class="grid md:grid-cols-2 gap-8">
                    <!-- Retry Count -->
                    <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 hover-card transition duration-300">
                        <h3 class="text-2xl font-bold mb-4 flex items-center">
                            <i class="fas fa-redo-alt text-blue-500 mr-2"></i>
                            重试次数配置
                        </h3>
                        <ul class="space-y-3 text-gray-700 mb-4">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><strong>默认重试次数</strong>: 普通消息默认重试16次，顺序消息无限重试，直到消费成功</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><strong>重试次数影响</strong>: 超过最大重试次数后，消息会进入死信队列，重试次数信息会记录在消息属性中</span>
                            </li>
                        </ul>
                        
                        <div class="code-block">
                            <pre><code class="language-java">// 设置最大重试次数为10次
consumer.setMaxReconsumeTimes(10);</code></pre>
                        </div>
                    </div>

                    <!-- Retry Interval -->
                    <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 hover-card transition duration-300">
                        <h3 class="text-2xl font-bold mb-4 flex items-center">
                            <i class="fas fa-hourglass-half text-purple-500 mr-2"></i>
                            重试间隔配置
                        </h3>
                        <ul class="space-y-3 text-gray-700 mb-4">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><strong>默认重试间隔策略</strong>: RocketMQ采用退避策略，重试间隔逐渐延长</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>默认间隔为: 10s, 30s, 1m, 2m, 3m, 4m, 5m, 6m, 7m, 8m, 9m, 10m, 20m, 30m, 1h, 2h</span>
                            </li>
                        </ul>
                        
                        <div class="code-block">
                            <pre><code class="language-properties"># 自定义延迟级别(单位:秒)
messageDelayLevel=1s 5s 10s 30s 1m 5m 10m 30m 1h 2h</code></pre>
                        </div>
                    </div>
                </div>

                <!-- Modes -->
                <div class="mt-8">
                    <h3 class="text-2xl font-bold mb-6 flex items-center">
                        <i class="fas fa-project-diagram text-green-500 mr-2"></i>
                        不同消费模式的重试策略
                    </h3>
                    
                    <div class="grid md:grid-cols-3 gap-6">
                        <!-- Cluster Mode -->
                        <div class="bg-white rounded-xl shadow-md p-6 hover-card transition duration-300">
                            <div class="flex items-center mb-3">
                                <div class="bg-blue-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-server text-blue-600"></i>
                                </div>
                                <h4 class="text-lg font-bold">集群消费模式</h4>
                            </div>
                            <ul class="text-gray-700 space-y-2">
                                <li>支持完整的重试机制</li>
                                <li>重试消息在所有消费者实例间负载均衡</li>
                            </ul>
                        </div>
                        
                        <!-- Broadcast Mode -->
                        <div class="bg-white rounded-xl shadow-md p-6 hover-card transition duration-300">
                            <div class="flex items-center mb-3">
                                <div class="bg-purple-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-broadcast-tower text-purple-600"></i>
                                </div>
                                <h4 class="text-lg font-bold">广播消费模式</h4>
                            </div>
                            <ul class="text-gray-700 space-y-2">
                                <li>默认不支持重试</li>
                                <li>需要消费者自行实现重试逻辑</li>
                            </ul>
                        </div>
                        
                        <!-- Ordered Mode -->
                        <div class="bg-white rounded-xl shadow-md p-6 hover-card transition duration-300">
                            <div class="flex items-center mb-3">
                                <div class="bg-green-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-sort-amount-down text-green-600"></i>
                                </div>
                                <h4 class="text-lg font-bold">顺序消费模式</h4>
                            </div>
                            <ul class="text-gray-700 space-y-2">
                                <li>同一队列的消息按原始顺序重试</li>
                                <li>无最大重试次数限制，持续重试直到成功或人工干预</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </section>

            <!-- Retry Queue Section -->
            <section id="retry-queue" class="mb-16">
                <h2 class="text-3xl font-bold mb-8 pb-2 border-b border-gray-200 flex items-center">
                    <i class="fas fa-database text-indigo-500 mr-3"></i>
                    重试队列的工作原理
                </h2>
                
                <h3 class="text-2xl font-bold mb-4">重试队列的基本概念</h3>
                <ul class="list-disc pl-6 space-y-3 mb-8 text-gray-700">
                    <li>
                        <strong>重试队列特性</strong>: 每个消费组都有自己专属的重试队列，重试队列的名称格式为: %RETRY%+消费组名，本质上也是一个特殊的Topic
                    </li>
                    <li>
                        <strong>重试队列的作用</strong>: 暂存消费失败需要重试的消息，按照重试时间顺序管理待重试消息，实现不同重试间隔的延迟投递
                    </li>
                </ul>
                
                <h3 class="text-2xl font-bold mb-4">重试消息的处理流程</h3>
                <div class="bg-white rounded-xl shadow-md p-6 mb-8">
                    <div class="mermaid">
                        graph TD
                            A[原始Topic消息] -->|消费失败| B(包装为重试消息)
                            B --> C[发送到重试队列(%RETRY%+消费组名)]
                            C -->|设置延迟级别| D{等待特定时间}
                            D -->|时间到| E[投递给消费者]
                            E --> F{消费成功/失败}
                            F -->|成功| G[结束流程]
                            F -->|失败| C
                            F -->|超过最大重试次数| H[发送到死信队列(%DLQ%+消费组名)]
                    </div>
                </div>
                
                <div class="grid md:grid-cols-2 gap-8">
                    <!-- Message Entry -->
                    <div class="bg-white rounded-xl shadow-md p-6 hover-card transition duration-300">
                        <h4 class="text-xl font-bold mb-3 flex items-center">
                            <i class="fas fa-sign-in-alt text-blue-500 mr-2"></i>
                            消息进入重试队列
                        </h4>
                        <ul class="list-disc pl-5 space-y-2 text-gray-700">
                            <li>消费者返回RECONSUME_LATER状态</li>
                            <li>Broker接收到消费失败的反馈</li>
                            <li>Broker将原消息复制并添加重试信息</li>
                            <li>消息被发送到重试队列并设置延迟级别</li>
                        </ul>
                    </div>
                    
                    <!-- Message Storage -->
                    <div class="bg-white rounded-xl shadow-md p-6 hover-card transition duration-300">
                        <h4 class="text-xl font-bold mb-3 flex items-center">
                            <i class="fas fa-hdd text-green-500 mr-2"></i>
                            重试消息的存储
                        </h4>
                        <ul class="list-disc pl-5 space-y-2 text-gray-700">
                            <li>重试消息带有原始消息的全部信息</li>
                            <li>增加重试次数(reconsumeTimes)属性</li>
                            <li>设置下一次重试的时间戳</li>
                        </ul>
                    </div>
                    
                    <!-- Message Delivery -->
                    <div class="bg-white rounded-xl shadow-md p-6 hover-card transition duration-300">
                        <h4 class="text-xl font-bold mb-3 flex items-center">
                            <i class="fas fa-truck text-purple-500 mr-2"></i>
                            重试消息的投递
                        </h4>
                        <ul class="list-disc pl-5 space-y-2 text-gray-700">
                            <li>达到重试时间后，从重试队列投递到消费者</li>
                            <li>消费者无需额外订阅，自动接收重试消息</li>
                            <li>重试消息与普通消息一样被消费处理</li>
                        </ul>
                    </div>
                    
                    <!-- Message Identification -->
                    <div class="bg-white rounded-xl shadow-md p-6 hover-card transition duration-300">
                        <h4 class="text-xl font-bold mb-3 flex items-center">
                            <i class="fas fa-fingerprint text-yellow-500 mr-2"></i>
                            重试消息识别
                        </h4>
                        <div class="code-block">
                            <pre><code class="language-java">public ConsumeConcurrentlyStatus consumeMessage(List&lt;MessageExt&gt; msgs, ConsumeConcurrentlyContext context) {
    for (MessageExt msg : msgs) {
        // 获取重试次数
        int reconsumeTimes = msg.getReconsumeTimes();
        if (reconsumeTimes > 3) {
            // 重试多次的消息特殊处理
            // ...
        }
    }
    return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}</code></pre>
                        </div>
                    </div>
                </div>
            </section>

            <!-- Best Practices Section -->
            <section id="best-practices" class="mb-16">
                <h2 class="text-3xl font-bold mb-8 pb-2 border-b border-gray-200 flex items-center">
                    <i class="fas fa-star text-indigo-500 mr-3"></i>
                    重试机制的最佳实践
                </h2>
                
                <div class="grid md:grid-cols-2 gap-8">
                    <!-- Column 1 -->
                    <div>
                        <div class="bg-white rounded-xl shadow-md p-6 mb-6 hover-card transition duration-300">
                            <h3 class="text-xl font-bold mb-3 flex items-center">
                                <i class="fas fa-sliders-h text-blue-500 mr-2"></i>
                                合理设置重试次数
                            </h3>
                            <ul class="list-disc pl-5 space-y-2 text-gray-700">
                                <li>根据业务恢复能力设置重试次数</li>
                                <li>临时性故障: 设置较多重试次数</li>
                                <li>致命性错误: 设置较少重试次数，快速进入死信队列</li>
                            </ul>
                        </div>
                        
                        <div class="bg-white rounded-xl shadow-md p-6 mb-6 hover-card transition duration-300">
                            <h3 class="text-xl font-bold mb-3 flex items-center">
                                <i class="fas fa-exchange-alt text-green-500 mr-2"></i>
                                实现幂等消费
                            </h3>
                            <ul class="list-disc pl-5 space-y-2 text-gray-700">
                                <li>由于消息可能多次重试，应确保消费逻辑具有幂等性</li>
                                <li>避免重复消费导致的数据不一致</li>
                            </ul>
                        </div>
                        
                        <div class="bg-white rounded-xl shadow-md p-6 hover-card transition duration-300">
                            <h3 class="text-xl font-bold mb-3 flex items-center">
                                <i class="fas fa-chart-line text-purple-500 mr-2"></i>
                                监控重试队列
                            </h3>
                            <ul class="list-disc pl-5 space-y-2 text-gray-700">
                                <li>设置重试队列的监控告警</li>
                                <li>过多的重试消息可能表明系统存在问题</li>
                            </ul>
                        </div>
                    </div>
                    
                    <!-- Column 2 -->
                    <div>
                        <div class="bg-white rounded-xl shadow-md p-6 mb-6 hover-card transition duration-300">
                            <h3 class="text-xl font-bold mb-3 flex items-center">
                                <i class="fas fa-filter text-red-500 mr-2"></i>
                                区分异常类型处理
                            </h3>
                            <ul class="list-disc pl-5 space-y-2 text-gray-700">
                                <li>对不同类型的异常采取不同的重试策略</li>
                                <li>对于无法通过重试解决的异常，应直接进入死信队列</li>
                            </ul>
                        </div>
                        
                        <div class="bg-white rounded-xl shadow-md p-6 mb-6 hover-card transition duration-300">
                            <h3 class="text-xl font-bold mb-3 flex items-center">
                                <i class="fas fa-skull text-gray-500 mr-2"></i>
                                处理死信消息
                            </h3>
                            <ul class="list-disc pl-5 space-y-2 text-gray-700">
                                <li>建立死信队列处理机制</li>
                                <li>可通过人工干预或自动脚本处理死信消息</li>
                            </ul>
                        </div>
                        
                        <div class="bg-white rounded-xl shadow-md p-6 hover-card transition duration-300">
                            <h3 class="text-xl font-bold mb-3 flex items-center">
                                <i class="fas fa-code text-yellow-500 mr-2"></i>
                                优化消费逻辑
                            </h3>
                            <ul class="list-disc pl-5 space-y-2 text-gray-700">
                                <li>首先优化消费逻辑，减少重试次数</li>
                                <li>对于可预见的间歇性故障，实现熔断和降级机制</li>
                            </ul>
                        </div>
                    </div>
                </div>
                
                <div class="bg-indigo-50 rounded-xl p-6 mt-8 border-l-4 border-indigo-500">
                    <h3 class="text-xl font-bold mb-3 flex items-center">
                        <i class="fas fa-lightbulb text-indigo-500 mr-2"></i>
                        总结
                    </h3>
                    <p class="text-gray-700">
                        通过合理配置和使用RocketMQ的消息重试机制，可以有效提高系统的可靠性和容错能力，确保消息在暂时性故障情况下仍能被可靠处理。
                    </p>
                </div>
            </section>
        </article>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12 px-4">
        <div class="max-w-6xl mx-auto">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold text-white mb-2">技术小馆</h3>
                    <p class="text-gray-400">深入探索技术细节，分享实用开发经验</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-indigo-400 hover:text-indigo-300 transition duration-300">
                        <i class="fas fa-book-open mr-2"></i>访问语雀主页
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-sm text-gray-500">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'dark',
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // Smooth scrolling for anchor links
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>
```